// for/for..in/forEach都是同步遍历，那么如何实现异步遍历
function simulateAsync(num){
    return new Promise((resolve)=>{
        setTimeout(()=>{
            resolve(num*num)
        },1000)
    })
}
const list=[1,2,3]
list.forEach(async item=>{
    const res=await simulateAsync(item)
    console.log('res=',res);
});

(async function(){
    for(let key of list){
        const result=await simulateAsync(key)
        console.log('result=',result);
    
    }
})()
